<?php
	$dsn = "mysql:host=127.0.0.1;dbname=c1";
	try{
		$pdo = new Pdo($dsn,"root","");
		$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
	}catch(PDOException $e){
		die($e->getMessage());
	}
	$pdo->query("SET NAMES utf8");
	try{
		$pdo->beginTransaction();
		$pdo->exec("INSERT INTO news (title,content) VALUES('一会我们讲解LINUX使用','讲解centos发行版的安装')");
		$pdo->exec("DELETE FROMsdf news");
		$pdo->commit();
	}catch(PDOException $e){
		$pdo->rollback();
		echo "操作失败，事务回滚";
	}
?>